bin=httpserver
#cgi=test_cgi
cc=g++
LD_FLAGS=-std=c++11 -lpthread -DEBUG=1
curr=$(shell pwd)
src=main.cc

.PHONY: ALL
ALL:$(bin) CGI
$(bin): $(src)
	$(cc) -o $@ $^ $(LD_FLAGS)
CGI:
	cd cgi;\
	make;\
	cd -;

.PHONY: clean
clean:
	rm $(bin) $(cgi)
	rm -rf output
	cd $(curr)/cgi;\
	make clean;\
	cd -

.PHONY: output
output:
	mkdir -p output
	cp $(bin) output
	cp -rf wwwroot output
	#cp $(cgi) output/wwwroot
	cp cgi/shell_cgi.sh output/wwwroot
	cp cgi/python_cgi.py output/wwwroot
	cp cgi/mysql_cgi output/wwwroot